package com.DAO;

import com.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserDao {
    @Insert("INSERT INTO zkl.user_table (username, email) VALUES (#{username}, #{email})")
    void addUser(User user);

    @Select("SELECT id, username, email FROM zkl.user_table")
    List<User> getAllUsers();

    @Update("UPDATE zkl.user_table SET username=#{username}, email=#{email} WHERE id=#{id}")
    void updateUser(User user);

    @Delete("DELETE FROM zkl.user_table WHERE id=#{id}")
    void deleteUserById(int id);
}
